
import shutil,subprocess



def run():


    try:
        shutil.rmtree('./allure-results') #删除allure历史数据
        shutil.rmtree('./allure-report') #删除allure历史数据
    except:
        pass


    allure_html = 'pytest  ./case_demo -vs  --alluredir allure-results'  # pytest测试框架主程序运行  "--env=prod","--reruns=3",
    subprocess.call(allure_html, shell=True)  # 生成allure的html报告


    allure_html = 'allure generate ./allure-results -o ./allure-report --clean'  # 生成allure的html报告
    subprocess.call(allure_html, shell=True)  # 生成allure的html报告





if __name__ == '__main__':
    run()
